package com.yyairmarkyy.arctool.customview;

import android.content.Context;
import android.graphics.Path;
import android.graphics.Point;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.MotionEvent;

import com.yyairmarkyy.arctool.util.Utils;


/**
 * Created by yyairmarkyy on 2017/10/18.
 */

public class ArcToolRecyclerview extends RecyclerView {


    private Path path;

    public ArcToolRecyclerview(Context context) {
        super(context);
        path = new Path();
    }

    public ArcToolRecyclerview(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);


    }



    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {

        if (ev.getAction() == MotionEvent.ACTION_DOWN){
            path.reset();
            path.addCircle(getWidth(),getHeight(),getHeight(), Path.Direction.CCW);
            if ( !Utils.pointInPath(path,new Point((int)ev.getX(),(int)ev.getY())))
                return false;
        }

        return super.dispatchTouchEvent(ev);
    }




}
